/* 全局box-sizing，防止padding撑大宽度 */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    font-family:
        'Microsoft YaHei',
        'PingFang SC',
        Arial,
        sans-serif,
        -apple-system,
        BlinkMacSystemFont,
        'Helvetica Neue',
        Helvetica,
        Segoe UI,
        Roboto,
        'miui',
        'Hiragino Sans GB';
    background-color: var(--van-background);
    color: var(--van-text-color);
}

/* 移动端适配 */
html {
    font-size: 16px;
}

/* 主容器样式 */
.main-container {
    max-width: 520px;
    margin: 0 auto;
    width: 100%;
    min-height: 100vh;
}

/* 1px边框解决方案 */
.van-hairline,
.van-hairline--top,
.van-hairline--bottom,
.van-hairline--left,
.van-hairline--right,
.van-hairline--top-bottom,
.van-hairline--surround {
    position: relative;
}

/* 自定义主题色 - 使用更高优先级 */
:root {
    --van-primary-color: #ff9800;
}

/* Vant弹窗类组件最大宽度520px并居中 */
@media (min-width: 520px) {

    /* 只对自定义 popup 居中和宽度限制 */
    .van-popup.my-center,
    .van-notify {
        left: 50% !important;
        transform: translateX(-50%) !important;
        max-width: 520px !important;
        width: 100% !important;
        box-sizing: border-box;
    }

    .van-action-sheet {
        left: 50% !important;
        transform: translateX(-50%) !important;
        max-width: 520px !important;
        width: 100% !important;
        box-sizing: border-box;
    }

    .van-picker,
    .van-calendar,
    .van-action-sheet,
    .van-action-sheet__content,
    .van-action-sheet__item {
        max-width: 520px !important;
        margin: 0 auto;
        box-sizing: border-box;
    }

    .van-calendar__content,
    .van-picker__columns {
        max-width: 520px;
        margin: 0 auto;
    }

    /* ImagePreview 图片最大宽度 */
    .van-image-preview__image {
        max-width: 520px;
        margin: 0 auto;
    }

    /* 虚拟键盘宽度 */
    .van-number-keyboard {
        left: 50% !important;
        transform: translateX(-50%) !important;
        max-width: 520px !important;
        width: 100% !important;
        box-sizing: border-box;
    }

    /* 底部菜单最大宽度容器 */
    .van-tabbar {
        left: 50% !important;
        transform: translateX(-50%) !important;
        max-width: 520px !important;
        width: 100% !important;
        box-sizing: border-box;
    }

    /* 固定导航栏最大宽度容器 */
    .navbar-wrapper {
        max-width: 520px;
        position: fixed;
        top: 0;
        right: 0;
        z-index: 100;
        width: 100%;
        left: 50%;
        transform: translateX(-50%);
    }
}

/* 通用工具类 */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mt-16 {
    margin-top: 16px;
}

.mb-16 {
    margin-bottom: 16px;
}

.p-16 {
    padding: 16px;
}